#include <57header.h>


//pthread_rwlock_t lock; // 定义一个读写锁
pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;

void *func(void *p){
    sleep(1);

    pthread_rwlock_rdlock(&lock);
    printf("son \n");
    pthread_rwlock_unlock(&lock);

    return NULL;
}
int main(int argc,char*argv[])
{

    pthread_t son_id;
    pthread_create(&son_id, NULL, func, NULL);

    pthread_rwlock_rdlock(&lock);
    printf("main \n");
    sleep(200);
    pthread_rwlock_unlock(&lock);

    pthread_join(son_id, NULL);
    return 0;
}

